package com.gitee.poi.plugin.core.handler.data;

import com.gitee.poi.plugin.annotations.data.Transform;

import java.lang.reflect.Field;

/**
 * @author wangxin
 * @time 2018/10/26 17:18
 */
public class TransformProcessor extends AbstractDataProcessor implements HandlerDataAnnotation {

    @Override
    public boolean support(Field field) {
        return field.getAnnotation(Transform.class) != null;
    }

    @Override
    protected HandlerData getHandlerData(Field field) throws Exception {
        Class<? extends HandlerData> clazz = field.getAnnotation(Transform.class).value();
        return clazz.newInstance();
    }
}
